//
//  ViewController.m
//  RosettaApplication2
//
//  Created by Taylor White on 11/20/13.
//  Copyright (c) 2013 Miami University. All rights reserved.
//

#import "ViewController.h"
#import <QuartzCore/QuartzCore.h>

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    self.navigationItem.hidesBackButton = YES;
    
    UIFont * rosettaFont = [UIFont fontWithName:@"DINOT-Regular" size:25];;
    //synthesize self.locationsArray;
    self.locationsArray = [[NSArray alloc] initWithObjects:@"Choose Area",@"Cleveland, OH", @"Princeton, NJ", @"San Luis Obispo, CA", @"San Jose, Costa Rica", @"No Preference", nil];

    self.location.delegate = self;
    self.location.dataSource = self;
    self.homeLabel.font = rosettaFont;
    [self.homeLabel setFont:rosettaFont];
    [self.next0 setFont:rosettaFont];
    [self.email setFont:rosettaFont];
    [self.name setFont:rosettaFont];

    self.rosettaImage.layer.cornerRadius = 5.0;
    self.rosettaImage.clipsToBounds = YES;
	// Do any additional setup after loading the view, typically from a nib.
    
    
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    [defaults setObject:@"Mahogany" forKey:@"option0"];
    [defaults setObject:@"REPTARRR" forKey:@"option1"];
    [defaults setObject:@"Communication" forKey:@"option2"];
    [defaults setObject:@"Programming" forKey:@"option3"];
    [defaults setObject:@"Business" forKey:@"option4"];
    [defaults setObject:@"More Business" forKey:@"option5"];
    [defaults setObject:@"Less Business" forKey:@"option6"];
    [defaults setObject:@"Science!" forKey:@"option7"];
    [defaults setObject:@"Magic" forKey:@"option8"];
    
    
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


- (IBAction)changeTextOnClick:(id)sender {
    self.homeLabel.text = self.name.text;
    [self.name resignFirstResponder];
    [self.email resignFirstResponder];
    
    NSString *name_store = [self.name text];
    NSString *email_store = [self.email text];
    
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    [defaults setObject:name_store forKey:@"name"];
    [defaults setObject:email_store forKey:@"email"];
    [defaults synchronize];
    
}



-(void) touchesBegan: (NSSet *) touches withEvent:(UIEvent *) event {
    [self.name resignFirstResponder];
    [self.email resignFirstResponder];
}


#pragma mark - UIPickerView DataSource
// returns the number of 'columns' to display.
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
    return 1;
}

// returns the # of rows in each component..
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
{
    return [self.locationsArray count];
}

#pragma mark - UIPickerView Delegate
- (CGFloat)pickerView:(UIPickerView *)pickerView rowHeightForComponent:(NSInteger)component
{
    return 30.0;
}

- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
    return [self.locationsArray objectAtIndex:row];
}

//If the user chooses from the pickerview, it calls this function;
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {

    NSString *loc = [self.locationsArray objectAtIndex:row];
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    [defaults setObject:loc forKey:@"location"];
    
}


- (IBAction)internChoice:(id)sender {
}

- (IBAction)fullTimeChoice:(id)sender {
}


@end
